import request from '@/utils/request'

import { Message, Loading } from 'element-ui';

// GET 请求
function get(url, params, headers = {}) {

    // return request({url, method: 'GET', params,is_loading:1 })


    return new Promise((resolve, reject) => {


        request({ url, method: 'GET', params, is_loading: 1 }).then((res => {

            if (res.code !== 200) {
                //   Message({ message: res.message, type: 'error' })
                resolve(res)
            } else {
                resolve(res)
            }
        })).catch(err => {

            Message({ message: err.message, type: 'error' })
        })

    })

}
// POST 请求
function post(url, params, headers = {}) {

    return new Promise((resolve, reject) => {


        request({ url, method: 'POST', params, is_loading: 1 }).then((res => {

            resolve(res)
        })).catch(err => {

            Message({ message: err.message, type: 'error' })
        })

    })



}


/**
 *  挂号相关接口  guahao_API
 *
 *
 */

let zhuyuan_hushi_gongzuozhang = {

    getHospitalizationGetMemberFeeList: query => get('/hospitalization/getMemberFeeList', query), //结算清单
}
let guahao_API = {

        getMedicalList: query => get('/ybh/getQdList', query), //结算清单

        getMemberProFile: query => get('/member/profile', query), //读卡

        postMemberSave: query => post('/member/save', query), //保存患者信息

        postMemberIndex: query => get('/member/index', query), //获取患者列表信息



        postRegisterSave: query => post('/register/save', query), //保存挂号信息

        getRegisterDoctorIndex: query => get('/register/doctorIndex', query), //查询医生列表

        getRegisterShow: query => get('/register/show', query), //查询医生列表

        getRegisterBack: query => post('/register/back', query), //退号


        getClinic_feeFeeIndex: query => get('/clinic_fee/feeIndex', query), //挂号 收费列表

        getClinic_feeFeeDel: query => post('/clinic_fee/del', query), //删除收费列表数据

        getClinic_feeFeeBack: query => post('/clinic_fee/back', query), //退费

        getClinic_feeFeeCancel: query => post('/clinic_fee/cancel', query), //作废


        getClinic_feeFeeFeeItem: query => get('/clinic_fee/feeItem', query), //收费列表详情

        getClinic_feeFeeFeePay: query => post('/clinic_fee/pay', query), //收费



    }
    /**
     *
     * 输液室
     */
let clinic_nurse = {
    getClinic_nurseInfusionIndex: query => get('/clinic_nurse/infusionIndex', query), //获取挂号患者列表

    getClinic_nurseSkinTestSave: query => post('/clinic_nurse/skinTestSave', query), //皮试

    getClinic_nurseGetSkinTestHistory: query => get('/clinic_nurse/getSkinTestHistory', query), //皮试结果
}


/**
 * 工作站接口
 *
 *
 */
let workStation_API = {

        getClinic_doctorRegister_index: query => get('/clinic_doctor/register_index', query), //获取挂号患者列表

        getClinic_doctorgetNextNumber: query => get('/clinic_doctor/getNextNumber', query), //获取下一个就诊患者
        callMember: query => post('/readcard/callMember', query), //获取下一个就诊患者

        getClinic_doctorCall: query => post('/clinic_doctor/call', query), //更新号码状态

        getClinic_doctorMemberInfo: query => post('/clinic_doctor/memberInfo', query), //获取患者挂号信息和个人信息

        getClinic_doctorgetDiseaseDict: query => get('/clinic_doctor/getDiseasePageDict', query), //获取疾病诊断数据字典

        getClinic_doctorgetDrugItem: query => get('/clinic_doctor/getDrugItem', query), //获取药品数据字典

        getClinic_doctorgetServiceItem: query => get('/clinic_doctor/getServiceItem', query), //获取诊疗项目数据字典

        getservice_feegetServiceGroup: query => get('/service_fee/getServiceGroup', query), //获取组合项目数据字典

        getClinic_doctorgetSaveRecipe: query => post('/clinic_doctor/saveRecipe', query), //保存处方

        getClinic_doctorgetSaveServiceItem: query => post('/clinic_doctor/saveServiceItem', query), //保存诊疗服务

        //clinic_doctor/call   //获取患者挂号信息和个人信息

        getByKey: query => get('/config/getByKey', query), //获取门诊病历模板
        getClinic_doctorGetRecipe: query => get('/clinic_doctor/getRecipe', query), //获取患者处方

        getClinic_doctorGetRecipeItem: query => get('/clinic_doctor/getRecipeItem', query), //获取处方详细信息

        getClinic_doctorSaveMedicalRecord: query => post('/clinic_doctor/saveMedicalRecord', query), //保存病历

        getClinic_doctorSaveRecipe: query => post('/clinic_doctor/saveRecipe', query), //保存处方和病历

        getClinic_doctorDelRecipe: query => post('/clinic_doctor/delRecipe', query), //保存处方和病历

        getClinic_doctorGetMedicalRecord: query => get('/clinic_doctor/getMedicalRecord', query), //病历列表

        getClinic_doctorGetMedicalRecordDetail: query => get('/clinic_doctor/getMedicalRecordDetail', query), //病历详情

        getClinic_doctorWorkLog: query => get('/clinic_doctor/workLog', query), //门诊日志列表



        getStatisticClinicOrder: query => get('/statistic/clinicOrder', query), //门诊处方统计

        getClinic_doctorGetRecipeItem: query => get('/clinic_doctor/getRecipeItem', query), //获取处方详细信息

        getStatisticClinicRegister: query => get('/statistic/clinicRegister', query), //挂号统计

        getClinic_drug_houseOutStatistic: query => get('/clinic_drug_house/outStatistic', query), //门诊消耗统计

        geth_pharmacyoutStatistic: query => get('/h_pharmacy/outStatistic', query), //住院消耗统计

        uploadPsnSlowDiseaseTreatment: query => post('/clinic_yb/uploadPsnSlowDiseaseTreatment', query), //治疗方案

        backPsnSlowDiseaseTreatment: query => post('/clinic_yb/backPsnSlowDiseaseTreatment', query), //治疗方案

        getPrintRecipeItem: query => get('/clinic_doctor/getPrintRecipeItem', query), //治疗方案
    }
    /**
     * 字典
     */
let dict_API = {
    getDict_dataDictIndex: query => get('/dict_data/dictIndex', query), //

    getCommonGetPinci: query => get('/common/getPinci', query), //频次

    getDrug_channelGetList: query => get('/drug_channel/getList', query), //给药途径

    getDeptIndex: query => get('/dept/index', query), //获取科室

    //药库列表
    getDrug_storeIndex: query => get('/drug_store/index', query), //药库列表  列：西药库 中药库

    //药房列表
    getDrug_houseIndex: query => get('/drug_house/index', query), //药房列表  列：门诊药房 住院药房

    //药品分类
    getDrugCategoryIndex: query => get('/drug/categoryIndex', query), //药品分类  列：青霉素类 麻醉药品

    //药品种类
    getDrugDrugSpeciesIndex: query => get('/drug/drugSpeciesIndex', query), //药品种类  列：西药 中药 耗材


    //用户人员
    getUserIndex: query => get('/user/index', query), //药品种类  列：西药 中药 耗材


    //获取字典值
    getSysbuildGetAllIcu: query => get('/sysbuild/getAllIcu', query), //level=2 表示病区

    //获取字典值
    getdosageGetList: query => get('/dosage/getList', query), //剂形

    //药品列表
    getdrugDrugIndex: query => get('/drug/drugIndex', query), //药品列表

}

//药房
let pharmacy_API = {
        getDrugOrderIndex: query => get('/clinic_drug_house/drugOrderIndex', query), //处方药品列表

        getDrugItem: query => get('/clinic_drug_house/drugItem', query), //处方详情

        getDrugFillNum: query => get('/clinic_drug_house/getDrugFillNum', query), //获取药品的批号和库存数



        getDrugDrugDispense: query => post('/clinic_drug_house/drugDispense', query), //配药

        getStoreDrugHandOut: query => post('/clinic_drug_house/drugHandOut', query), //发药

        getStoreDrugBack: query => post('/clinic_drug_house/drugBack', query), //退药


        getclinic_drug_houseDispenseInfo: query => get('/clinic_drug_house/dispenseInfo', query), //配药详情


        getStoreIndex: query => get('/drug_house/storeIndex', query), //库存 药品列表
        getStoreDrugNumShow: query => get('/drug_house/storeDrugNumShow', query), //库存 药品列表详情
        getStoreDrugClaimRecord: query => get('/drug_house/storeDrugClaimRecord', query), //库存 领用记录
    }
    //住院药房
let hospitalization = {
    getH_pharmacyGetList: query => get('/h_pharmacy/getList', query), //住院药房列表

    getH_pharmacyGetDetail2: query => get('/h_pharmacy/getDetail2', query), //医药单详情

    getH_pharmacyGetDetail: query => get('/h_pharmacy/getDetail', query), //获取配药单(配药明细)

    getH_pharmacyGetDrugItem: query => get('/h_pharmacy/getDrugItem', query), //获取配药单(配药明细)

    getH_pharmacyDrugDispense: query => post('/h_pharmacy/drugDispense', query), //提交配药单

    getH_pharmacyDrugHandOut: query => post('/h_pharmacy/drugHandOut', query), //发药

    getH_pharmacyRefundDrug: query => post('/h_pharmacy/refundDrug', query), //退药接口

}


//药库管理
let drug_Storage_API = {
        getdrug_storeDrugIndex: query => get('/drug_store/drugIndex', query), //列表

        getdrug_storedDugNumShow: query => get('/drug_store/drugNumShow', query), //库存数量详情



        getdrug_storeDrugNumIndex: query => get('/drug_store/drugNumIndex', query), //药品库存列表

        getdrug_storedStoreUpload: query => post('/drug_store/storeUpload', query), //商品盘存


    }
    // 采购申请
let drug_purchase_API = {
        getdrug_purchaseIndex: query => get('/drug_purchase/index', query), //列表

        getdrug_purchasShow: query => get('/drug_purchase/show', query), //详情

        getdrug_purchaseSave: query => post('/drug_purchase/save', query), //保存

        getdrug_purchaseCheck: query => post('/drug_purchase/check', query), //审核

        getdrug_purchaseDel: query => post('/drug_purchase/del', query), //删除

    }
    // 入库管理
let drug_into_store_API = {
        getdrug_into_storeIndex: query => get('/drug_into_store/index', query), //列表

        getdrug_into_storeShow: query => get('/drug_into_store/show', query), //详情

        getdrug_into_storeSave: query => post('/drug_into_store/save', query), //保存

        getdrug_into_storeCheck: query => post('/drug_into_store/check', query), //审核

        getdrug_into_storeDel: query => post('/drug_into_store/del', query), //删除

        getdrug_into_storeAccept: query => post('/drug_into_store/accept', query), //接收

    }
    // 出库管理
let drug_out_store_API = {
    getdrug_out_storeIndex: query => get('/drug_out_store/index', query), //列表

    getdrug_out_storeShow: query => get('/drug_out_store/show', query), //详情

    getdrug_out_storeSave: query => post('/drug_out_store/save', query), //保存

    getdrug_out_storeCheck: query => post('/drug_out_store/check', query), //审核

    getdrug_out_storeDel: query => post('/drug_out_store/del', query), //删除

    getdrug_out_storeAccept: query => post('/drug_out_store/accept', query), //接收

}

// 药品领用
let drug_claim_API = {
    getdrug_claimIndex: query => get('/drug_claim/index', query), //列表

    getdrug_claimShow: query => get('/drug_claim/show', query), //详情

    getdrug_claimSave: query => post('/drug_claim/save', query), //保存

    getdrug_claimCheck: query => post('/drug_claim/check', query), //审核

    getdrug_claimDel: query => post('/drug_claim/del', query), //删除

    getdrug_claimAccept: query => post('/drug_claim/accept', query), //接收

    getdrug_claimSelect: query => get('/drug_store/select', query), //选择可领用药品




}

// 药品退领
let drug_house_API = {
    getdrug_houseExitClaimIndex: query => get('/drug_house/exitClaimIndex', query), //列表

    getdrug_houseExitClaimShow: query => get('/drug_house/exitClaimShow', query), //详情

    getdrug_houseExitClaimSave: query => post('/drug_house/exitClaimSave', query), //保存

    getdrug_houseExitClaimCheck: query => post('/drug_house/exitClaimCheck', query), //审核

    getdrug_houseExitClaimDel: query => post('/drug_house/exitClaimDel', query), //删除

    getdrug_houseExitClaimAccept: query => post('/drug_house/exitClaimAccept', query), //接收

    getdrug_houseSelectIndex: query => get('/drug_house/selectIndex', query), //获取退领 需要select的药品


}

//挂号设置 医生排班
let register_conf_API = {
    getregister_confFeeIndex: query => get('/register_conf/feeIndex', query), //列表
    getregister_confFeeSave: query => post('/register_conf/feeSave', query), //添加和修改挂号费
    getdeptIndex: query => get('/dept/index', query), //组织架构列表

    getregister_confFeeStatus: query => post('/register_conf/feeStatus', query), //修改状态

    getregister_confFeeWorkScheduleSet: query => post('/register_conf/workScheduleSet', query), //报错医生的排班配置信息
    getregister_confFeeWorkScheduleGet: query => get('/register_conf/workScheduleGet', query), //获取医生的排班配置信息

    getregister_confFeeWorkScheduleDel: query => post('/register_conf/workScheduleDel', query), //删除

    getregister_confWorkScheduleSet: query => post('/register_conf/workScheduleSet', query), //保存


}
let yibao_dept_API = {
    getdeptUploadYb: query => post('/dept/uploadYb', query), //医保科室 编辑和保存
    getdeptBackYb: query => post('/dept/backYb', query), //医保科室撤销

    getmemberGetInfo: query => get('/member/getInfo', query), //医保获取用户的医保信息

    queryPsnSlowDisease: query => get('/clinic_yb/queryPsnSlowDisease', query), //查询是否备案
    // getReadcardUserinfo: query => get('/readcard/userinfo', query), //读卡获取用户信息(社保卡)
    queryPsnSlowTreatRecord: query => get('/clinic_yb/queryPsnSlowTreatRecord', query), //查治疗方案

    // readcardReadidcard: query => get('/readcard/readidcard', query), //读取身份证



    getReadcardUserinfo: query => get('/readcard/readidcard', query), //读卡身份证
    getReadcardUserinfo2: query => get('/readcard/userinfo', query), //读卡社保卡

    getregisterYbRegister: query => post('/register/ybRegister', query), //门诊挂号

    getregisterYbRegisterUnion: query => post('/register/ybRegisterUnion', query), //门诊挂号(包含挂号，上传诊断和费用明细)



    getregisterUploadFeeInfo: query => post('/register/uploadFeeInfo', query), //门诊挂号 门诊上传费用明细

    getregisterPrepareSettlement: query => post('/register/prepareSettlement', query), //门诊挂号 预结算

    getregisterSettlement: query => post('/register/settlement', query), //门诊挂号 结算


    getclinic_feeSettlement: query => post('/clinic_fee/settlement', query), //门诊费用结算

    getclinic_feePrepareSettlement: query => post('/clinic_fee/prepareSettlement', query), //门诊费用预结算



    getclinic_feeUploadVisitInfo: query => post('/clinic_fee/uploadVisitInfo', query), //就诊信息上传

    getclinic_feeUuploadFeeInf: query => post('/clinic_fee/uploadFeeInfo', query), // 收费费用明细上传

    getclinic_RegisterFeeInf: query => post('/register/uploadFeeInfo', query), //门诊费用明细上传
   
    getregisterBackFeeUpload: query => post('/register/backFeeUpload', query), //撤销费用明细
    getregisterBackFeeUpload2: query => post('/clinic_fee/backFeeUpload', query), //撤销费用明细
    getregisterYbRegisterBack: query => post('/register/ybRegisterBack', query), //撤销挂号
    getClinicSetl: query => post('/clinic_yb/getClinicSetl', query), //门诊结算费用

    getYbCashSearch: query => post('/ybh/getYbCashSearch', query), //门诊结算费用
    getclinic_ybCheckSettlement: query => post('/clinic_yb/checkSettlement', query), //费用结算对总账

    getclinic_ybCheckDetailSettlement: query => post('/clinic_yb/checkDetailSettlement', query), //费用结算对明细账

    getclinic_ybBackRightSettle: query => post('/clinic_yb/backRightSettle', query), //挂号结算冲正

    getclinic_ybBackOrderRightSettle: query => post('/clinic_yb/backOrderRightSettle', query), //门诊结算冲正

    getregisterDownReportForm: query => get('/register/downReportForm', query), //结算清单下载挂号
    getclinic_feeSbDownReportForm: query => get('/clinic_fee/downSbReportForm', query), //商保结算清单下载挂号

    getclinic_feeDownReportForm: query => get('/clinic_fee/downReportForm2', query), //结算清单下载收费

    getclinic_feeSaveDrugRecipe: query => post('/clinic_fee/saveDrugRecipe', query), //划价



}
let chronicIdiopathicDisease_API = {
    getmemberChronicMember: query => get('/member/chronicMember', query), //慢特病备案患者列表
    getclinic_ybUploadPsnSlowDisease: query => post('/clinic_yb/uploadPsnSlowDisease', query), //慢特病备案

    getclinic_ybBackPsnSlowDisease: query => post('/clinic_yb/backPsnSlowDisease', query), //慢特病备案撤销
    getdict_dataGetChronicDiseaseDict: query => get('/dict_data/getChronicDiseaseDict', query), //获取慢特病字典


}
let Print = {
        getPrintReport: query => get('/register/getPrintReport', query),

    }
    //角色
let role = {
        getRoleIndex: query => get('/role/index', query),

        getRoleSave: query => post('/role/save', query),

        getRoleDel: query => post('/role/del', query),

        getRoleCopy: query => post('/role/copy', query),

        getPermissionMenuIndex: query => get('/permission/menuIndex', query),

        getPermissionSave: query => post('/permission/save', query),


    }
    //模板
let temapleAPI = {
    //报错模板
    getmedical_record_tplTplSave: query => post('/medical_record_tpl/tplSave', query),


};

export const _API = {

    registerIndex: query => get('register/index', query), //清单结算列表

    ...temapleAPI, //模板
    ...role, //角色
    ...clinic_nurse, //输液室
    ...guahao_API, //挂号接口

    ...workStation_API, //工作站接口
    ...dict_API, //数字字典
    ...pharmacy_API, //药房
    ...drug_purchase_API, //采购申请
    ...drug_into_store_API, //入库管理
    ...drug_out_store_API, //出库管理
    ...drug_claim_API, //药品领用
    ...drug_house_API, //药品退领
    ...register_conf_API, //挂号设置
    ...hospitalization, //住院药房
    ...drug_Storage_API, //药库管理
    ...yibao_dept_API, //医保科室设置
    ...chronicIdiopathicDisease_API, //慢特病
    ...Print,
    ...zhuyuan_hushi_gongzuozhang,
}













//







// export const _API_bai={
//     getMedicalList,

// }
